package org.com.structuralPattern.compositePattern;

import java.util.ArrayList;

/**
 * @author Jonny
 * @version 1.0
 * @Description:
 * @date 2021/4/15 9:44
 */
public class Composite implements Component {

    private ArrayList<Component> componentList=new ArrayList<Component>();


    public void add(Component component){
        this.componentList.add(component);
    }

    public void remove(Component component){
        this.componentList.remove(component);
    }

    public ArrayList<Component> getChild(){
        return this.componentList;
    }

    @Override
    public void operation() {
        //业务逻辑代码
    }
}
